#include <iostream>
using namespace std;
string Number_conversion(int num,int m){
    string str;
    int n;
    while(num>0){
        n=num%m;
        if(n>9){
            str.push_back(n-10+'A');
        }
        else{
            str.push_back(n+'0');
        }
        num/=m;
    }
    int len=str.length()/2;
    for(int i=0;i<len;i++){
        char tmp=str[i];
        str[i]=str[str.length()-i-1];
        str[str.length()-i-1]=tmp;
    }
    return str;
}
int main()
{
    int n,m;
    cout<<"请输入十进制数字n>>";cin>>n;
    cout<<"请输入转换之后的进制m>>";cin>>m;
    cout<<Number_conversion(n,m)<<endl;
    return 0;
}